package com.ruoyi.web.core.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * Swagger2的接口配置
 *
 * @author ruoyi
 */
@Configuration
@ConfigurationProperties(prefix = "business.config")
public class FyglConfig {

    private Map<String, String> fyglMonthKey;

    public Map<String, String> getFyglMonthKey() {
        return fyglMonthKey;
    }

    public void setFyglMonthKey(Map<String, String> fyglMonthKey) {
        this.fyglMonthKey = fyglMonthKey;
    }

    /**
     * 将fyglMonthKey的key和value翻转后的map
     *
     * @return
     */
    public Map<String, String> getReversedMap() {
        Map<String, String> reversedMap = new HashMap<>(fyglMonthKey.size());
        fyglMonthKey.forEach((k, v) -> {
            reversedMap.put(v, k);
        });
        return reversedMap;
    }
}
